package com.example.hotelrear.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
<<<<<<< HEAD
import com.example.hotelrear.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
=======
import org.apache.ibatis.annotations.Mapper;
>>>>>>> c858df565d55deb60e87bd48c878762d1fd5080a

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author FengXiao
 * @since 2023-08-28
 */
@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    @Select("select count(*) from orderList where user_id=#{id} and status='已支付'")
    public int paid(int id);

    @Select("select count(*) from orderList where user_id=#{id} and status='待支付'")
    public int notpaid(int id);

    @Select("select count(*) from orderList where user_id=#{id} and status='待评价'")
    public int TobeComment(int id);

    //全部订单
    @Select("select * from orderList where user_id=#{id}")
    public List<Order> findAllOrderById(int id);
    //待付款
    @Select("select * from orderList where user_id=#{id} and status='待付款'")
    public List<Order> findNoPaidOrderById(int id);
    //已付款
    @Select("select * from orderList where user_id=#{id} and status='已付款'")
    public List<Order> findPaidOrderById(int id);
    //待评价

    @Select("select * from orderList where user_id=#{id} and status='待评价'")
    public List<Order> findNoCommentOrderById(int id);
    //已失效

    @Select("select * from orderList where user_id=#{id} and status='已失效'")
    public List<Order> findInactiveOrderById(int id);
    //已取消

    @Select("select * from orderList where user_id=#{id} and status='已取消'")
    public List<Order> findCancleOrderById(int id);
}
